const EXPECTED_MARRIAGE_TIME_LIST = [
	{
		name: '半年内',
		value: 6,
	},
	{
		name: '一年内',
		value: 12,
	},
	{
		name: '两年内',
		value: 24,
	},
	{
		name: '还没想好',
		value: 0
	},
]


export const getExpectedMarriageTimeList = ({ hasEmpty = true } = {}) => {
  const list = [...EXPECTED_MARRIAGE_TIME_LIST];
  if (hasEmpty) {
    list.push({
			name: '不限',
			value: null,
		})
  }

  return list
}

export const getExpectedMarriageTimeByIndex = ({ hasEmpty = true, index } = {}) => {
	if (!Number.isInteger(index)) {
		return {
			name: "",
			value: null
		}
	}

  const list = getExpectedMarriageTimeList({ hasEmpty });

	const value = list[index];
	return value
}

export const getExpectedMarriageTimeTextByValue = ({ hasEmpty = true, value } = {}) => {
	const list = getExpectedMarriageTimeList({ hasEmpty });
	const obj = list.find(item => item.value === value)

	if (!obj) {
		return ""
	}

	return obj.name
}